<template>
	<view class="wrapper" >
		<zy-grid :col="3" :showTip="false" :showTitle="false" :dataList="dadataList"></zy-grid>
	</view>
</template>

<script>
	import zyGrid from '../../components/zy-grid/zy-grid.vue'
	export default {
		components: {
			zyGrid
		},
		methods: {
			onNavigationBarButtonTap(e) {
				const index = e.index;
				console.log(index);
				if (index == 0) {
					uni.reLaunch({
						url: "../index/index"
					})
				} else if (index == 1) {
                      
				}
			},
		},
		onLoad() {
			
			let PDA_Module_Android = uni.getStorageSync("PDA_Module_Android","{}"); //获取单据权限
			PDA_Module_Android = JSON.parse(PDA_Module_Android);
			let PDA_Module_Options = uni.getStorageSync("PDA_Module_Options","{}"); //获取单据权限
			PDA_Module_Options = JSON.parse(PDA_Module_Options);
			var that = this;
			PDA_Module_Options.forEach((item,index)=>{
				if (item.ModuleName == "引用验单") {
					if (item.IsBill == "") {
						console.log(that.isManger);
						that.isManger = false;
						uni.showToast({
							title:"无开单权限",
							duration:1000
						})
					}
				}
			});
			console.log(this.isManger);
			// if(!this.isManger){
			// 	return;
			// }
			PDA_Module_Android.forEach((item, index) => {
				console.log(item.ModuleName);
				if (item.ModuleName == "采购订单") {
					if (item.IsBill == "") {
						that.dadataList[0].isShow = false;
					}
				} else if (item.ModuleName == "采购入库单") {
					if (item.IsBill == "") {
						that.dadataList[1].isShow = false;
					}
				} else if (item.ModuleName == "采购退货单") {
					if (item.IsBill == "") {
						that.dadataList[2].isShow = false;
					}
				} else if (item.ModuleName == "销售订单") {
					if (item.IsBill == "") {
						that.dadataList[3].isShow = false;
					}
				} else if (item.ModuleName == "销售出库单") {
					if (item.IsBill == "") {
						that.dadataList[4].isShow = false;
					}
				} 
				else if (item.ModuleName == "销售退货单") {
					if (item.IsBill == "") {
						that.dadataList[5].isShow = false;
					}
				}  else if (item.ModuleName == "其他入库单") {
					if (item.IsBill == "") {
						that.dadataList[6].isShow = false;
					}
				} else if (item.ModuleName == "其他出库单") {
					if (item.IsBill == "") {
						that.dadataList[7].isShow = false;
					}
				} 
				else if (item.ModuleName == "促销单") {
					if (item.IsBill == "") {
						that.dadataList[8].isShow = false;
					}
				}
				else if (item.ModuleName == "调拨单") {
					if (item.IsBill == "") {
						that.dadataList[9].isShow = false;
					}
				}
				else if (item.ModuleName == "配送申请单") {
					if (item.IsBill == "") {
						that.dadataList[10].isShow = false;
					}
				} 
				else if (item.ModuleName == "配送出库单") {
					if (item.IsBill == "") {
						that.dadataList[11].isShow = false;
					}
				}else if (item.ModuleName == "配送退回单") {
					if (item.IsBill == "") {
						that.dadataList[12].isShow = false;
					}
				}  else if (item.ModuleName == "收款单") {
					if (item.IsBill == "") {
						that.dadataList[13].isShow = false;
					}
				} else if (item.ModuleName == "付款单") {
					if (item.IsBill == "") {
						that.dadataList[14].isShow = false;
					}
				} else if (item.ModuleName == "会员充值") {
					if (item.IsBill == "") {
						that.dadataList[15].isShow = false;
					}
				} else if (item.ModuleName == "盘点单") {
					if (item.IsBill == "") {
						that.dadataList[16].isShow = false;
					}
				}
			});
		},
		data() {
			return {
				dadataList: [{
						name: "采购订单",
						imgUrl: '../../static/orderlist/cg.svg',
						url: '../add-order/add-cgorder?BillName=' + "采购订单",
						isShow: true
					},
					{
						name: "采购入库单",
						imgUrl: '../../static/orderlist/cg.svg',
						url: '../add-order-rk-ck/add-cgorder-rk-ck?BillName=' + "采购入库单",
						isShow: true
					},
					{
						name: "采购退货单",
						imgUrl: '../../static/orderlist/cg.svg',
						url: '../add-order-rk-ck/add-cgorder-rk-ck?BillName=' + "采购退货单",
						isShow: true
					},
					{
						name: "销售订单",
						imgUrl: '../../static/orderlist/sale.svg',
						url: '../add-order/add-cgorder?BillName=' + "销售订单",
						isShow: true
					},
					{
						name: "销售出库单",
						imgUrl: '../../static/orderlist/sale.svg',
						url: '../add-order-rk-ck/add-cgorder-rk-ck?BillName=' + "销售出库单",
						isShow: true
					},
					{
						name: "销售退货单",
						imgUrl: '../../static/orderlist/sale.svg',
						url: '../add-order-rk-ck/add-cgorder-rk-ck?BillName=' + "销售退货单",
						isShow: true
					},

					{
						name: "其他入库单",
						imgUrl: '../../static/orderlist/yw.svg',
						url: '../add-order-rk-ck/add-cgorder-rk-ck?BillName=' + "其他入库单",
						isShow: true
					},
					{
						name: "其他出库单",
						imgUrl: '../../static/orderlist/yw.svg',
						url: '../add-order-rk-ck/add-cgorder-rk-ck?BillName=' + "其他出库单",
						isShow: true
					},
					{
						name: "促销单",
						imgUrl: '../../static/orderlist/yw.svg',
						url: '../add-order/add-cgorder?BillName=' + "促销单",
						isShow: true
					},
					{
						name: "调拨单",
						imgUrl: '../../static/orderlist/yw.svg',
						url: '../add-order-allot/add-cgorder-allot?BillName=' + "调拨单",
						isShow: true
					},
					{
						name: "配送申请单",
						imgUrl: '../../static/orderlist/yw.svg',
						url: '../add-order-delivery/add-order-delivery?BillName=' + "配送申请单",
						isShow: true
					}, {
						name: "配送出库单",
						imgUrl: '../../static/orderlist/yw.svg',
						url: '../add-order-delivery/add-order-delivery?BillName=' + "配送出库单",
						isShow: true
					}, {
						name: "配送退回单",
						imgUrl: '../../static/orderlist/yw.svg',
						url: '../add-order-delivery/add-order-delivery?BillName=' + "配送退回单",
						isShow: true
					}, {
						name: "收款单",
						imgUrl: '../../static/orderlist/yw.svg',
						url: '../add-order-gathering/add-order-gathering?BillName=' + "收款单",
						isShow: true
					}, {
						name: "付款单",
						imgUrl: '../../static/orderlist/yw.svg',
						url: '../add-order-gathering/add-order-gathering?BillName=' + "付款单",
						isShow: true
					},
					{
						name: "会员充值",
						imgUrl: '../../static/orderlist/yw.svg',
						url: '../add-order-gathering/add-order-gathering?BillName=' + "会员充值",
						isShow: true
					}
					// , {
					// 	name: "盘点单",
					// 	imgUrl: '../../static/orderlist/yw.svg',
					// 	url: '../add-order-Inventory/add-order-Inventory?BillName=' + "盘点单",
					// 	isShow: true
					// }
				],
				isManger:true
			}
		}
	}
</script>


<style lang="scss">
	page {
		width: 100%;
		height: 100%;
		padding-bottom: 0px;
	}
</style>
